home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Tool Chest / Dev.CD Feb 97 TC.toast / Sample Code / Development Tools & Languages / AppsToGo / DTS.Lib / DTS.Lib.headers / Preferences.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  3.5 KB  |  102 lines  |  [TEXT/MPS ]

  1. #ifndef __PREFERENCES__
  2. #define __PREFERENCES__
  3.  
  4. #ifndef __TYPES__
  5. #include <Types.h>
  6. #endif
  7.  
  8.  
  9.  
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14.  
  15.  
  16. OSErr        ReadPreferences(OSType prefType, OSType prefCreator, short prefLocID);
  17.     /*
  18.     **    ¶ Read the application's preference information.
  19.     **    
  20.     **    INPUT:    prefType        If there is no preference file yet, then create
  21.     **                            one of this type.
  22.     **    INPUT:    prefCreator        If there is no preference file yet, then create
  23.     **                            one of using this creator (self, assumably).
  24.     **            prefLocID        The ID of a 'STR#' resource that contains the
  25.     **                            preferences folder name in string 1 and the
  26.     **                            preferences file name in string 2.
  27.     **    RESULT:    OSErr
  28.     **
  29.     **    If you want framework preferences support, then you need to make this call during
  30.     **    startup in your application.  (AppWannabe already does.)  It does the following:
  31.     **    1.    Try to create the designated preferences folder/file.
  32.     **    2.    Open the preferences file resource fork.
  33.     **    3.    Read in resource 'aprf' ID #128.
  34.     **
  35.     **    Note that if the 'aprf' resource isn't in the preferences file, then since
  36.     **    it is a resource, it may get it out of the resource chain elsewhere.  Therefore
  37.     **    if you want to ship your application with default preferences, first allow
  38.     **    your application to create the preferences file, and then copy the 'aprf' ID #128
  39.     **    resource from the preferences files into your application.
  40.     **
  41.     **    The AppsToGo editor does support window position as a preference for runtime-only
  42.     **    documents (starting with version 6.0 of the editor).
  43.     **
  44.     **    Using version 6.0 of the editor, if you choose "Preserve Doc Screen Location" for a
  45.     **    runtime-only document, AND if you are using the framework preferences facility, then the
  46.     **    window position and visibility will be recorded in the preferences file.
  47.     **
  48.     **    __________
  49.     **
  50.     **    Also see:    WritePreferences, GetPreference. */
  51.  
  52. OSErr        WritePreferences(void);
  53.     /*
  54.     **    ¶ Write the application's preference information.
  55.     **
  56.     **    RESULT:    OSErr
  57.     **
  58.     **    If you want framework preferences support, then you need to make this call
  59.     **    during shutdown in your application.
  60.     **
  61.     **    The AppsToGo editor does support window position as a preference for runtime-only
  62.     **    documents.  Ify you choose "Preserve Doc Screen Location" for a runtime-only
  63.     **    document, AND if you are using the framework preferences facility, then the window
  64.     **    position and visibility will be recorded in the preferences file.
  65.     **
  66.     **    __________
  67.     **
  68.     **    Also see:    ReadPreferences, GetPreference. */
  69.  
  70. TreeObjHndl    GetPreference(OSType prefType, Boolean *newPref);
  71.     /*
  72.     **    ¶ Get a preferences reference by type.
  73.     **
  74.     **    INPUT:    prefType        The OSType (AppsToGo editor) to search for.
  75.     **            newPref            If nil is passed in, then if the requested type is
  76.     **                            not found, nil is returned.  If you pass in a pointer,
  77.     **                            then if the requested type is not found, one is created
  78.     **                            and returned, and true is returned to indicate that
  79.     **                            a new preference was created.
  80.     **    RESULT:    TreeObjHndl        AppsToGo uses this object to hold the window position
  81.     **                            information.  However, you can add children to this
  82.     **                            object of any type you wish to store whatever you wish.
  83.     **
  84.     **    Note that you can add 'aprf' children to the preference root directly if you wish.
  85.     **    You may wish to do this to have a place to store extra preference information.
  86.     **    Just call NewChild in the same fashion that GetPreference does, and then add
  87.     **    children to the preference object of your own type.
  88.     **
  89.     **    __________
  90.     **
  91.     **    Also see:    ReadPreferences, WritePreferences. */
  92.  
  93.  
  94.  
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98.  
  99.  
  100.  
  101. #endif
  102.